import http.cookiejar, urllib.request

filename="cookies.txt"
cookie = http.cookiejar.MozillaCookieJar(filename)
handler = urllib.request.HTTPCookieProcessor(cookie)
opener = urllib.request.build_opener(handler)
response = opener.open('http://www.baidu.com')
cookie.save(ignore_discard=True, ignore_expires=True)

filename2 = "cookies2.txt"
cookie2 = http.cookiejar.LWPCookieJar(filename2)
handler2 = urllib.request.HTTPCookieProcessor(cookie2)
opener2 = urllib.request.build_opener(handler2)
response = opener2.open('http://www.baidu.com')
cookie2.save(ignore_discard=True, ignore_expires=True)
